<?php
namespace Api;
use Kuyuan\WqCore\api\Api;
use Kuyuan\WqCore\util\Util;

/**
 * 员工
 * Class Staff
 * @package Api
 */
class Staff extends Api
{
    private $Staff = null;
    public function __construct()
    {
        parent::__construct();
        $this->Staff = new \Controller\Staff();
    }

    /**
     * 获取当前用户下的员工列表
     */
    public function getUserStaffList()
    {
        Util::appointGet();
        $_list = $this->Staff->getUserStaffList();
        if($_list) {
            $_result = array("code"=>0,"data"=>$_list);
        } else {
            $_result = array("code"=>101);
        }
        Util::returns($_result);
    }

    /**
     * 修改状态
     */
    public function changeStatus()
    {
        Util::appointPost();
        if($this->Staff->edit(
            array("status"=>$this->_gpc["status"]),
            $this->_gpc["staff_id"]
        )) {
            $_result = array("code"=>0);
        } else {
            $_result = array("code"=>103);
        }
        Util::returns($_result);
    }

}